package com.hljx.controller;

import io.swagger.v3.oas.annotations.Operation;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 血透数据表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2024-08-21
 */
@RestController
@RequestMapping("/vmHdTreatXg")
public class VmHdTreatXgController {
    @Autowired
    private JobLauncher jobLauncher;
    @Autowired
    @Qualifier("VmHdTreatXGJob")
    private Job sampleJob;

    @Operation(description = "浒关住院非药品明细表")
    @GetMapping("/runVmHdTreatXGJob")
    public void runVmHdTreatXGJob() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {
        JobParameters jobParameters = new JobParametersBuilder()
                .addLong("time",System.currentTimeMillis())
                .addString("startTime", "2024-04-01")
                .addString("endTime","2024-06-30")
                .addString("splitTableName","20242")
                .toJobParameters();
        jobLauncher.run(sampleJob, jobParameters);
    }

}
